Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: DPE-5656 log rotation new options #597

Merged
merged 13 commits into from
Feb 6, 2025

Conversation

paulomach
Copy link
Contributor

@paulomach paulomach commented Jan 24, 2025

Issue

DA124 implementation

Solution

Adds:

  • new config option for log retention period
  • new config option for audit log policy
  • dynamic behavior for log compression and log retention period, depending on COS/logs being pushed.

Fixes #539

Copy link
Contributor

@sinclert-canonical sinclert-canonical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial code revision, requested by Paulo.

Copy link
Contributor

@shayancanonical shayancanonical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log-syncing script once a COS relation is formed that waits to ensure that logs are being synced before changing the logrotation config -> the whole mechanism seems clunky. However, it seems like a sure fire way of ensuring that logs are syncing before the logrotation config is changed

Another option would be to check grep mysql.*log ${POSTIONS_FILE} in the constructor of the charm (along with a no-op if the action is already taken) -> this will be unexpected-error proof with a retry mechanism built in (when the next update-status runs). Thoughts?

Copy link
Contributor

@sinclert-canonical sinclert-canonical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thanks for addressing all my comments!

@paulomach
Copy link
Contributor Author

The log-syncing script once a COS relation is formed that waits to ensure that logs are being synced before changing the logrotation config -> the whole mechanism seems clunky. However, it seems like a sure fire way of ensuring that logs are syncing before the logrotation config is changed

Another option would be to check grep mysql.*log ${POSTIONS_FILE} in the constructor of the charm (along with a no-op if the action is already taken) -> this will be unexpected-error proof with a retry mechanism built in (when the next update-status runs). Thoughts?

On point. I've refactored to remove the need of the custom event, and rely on update_status instead, since this can be somewhat lazy

Copy link
Contributor

@shayancanonical shayancanonical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though I left a possible minor improvement suggestion


self.charm = charm

self.framework.observe(self.charm.on.update_status, self._update_logs_rotation)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor suggestion: we can just call self._update_logs_rotation() here to have it run for any event that comes in (not just update-status). However, upon update-status is good too!

@paulomach paulomach merged commit 24fea96 into main Feb 6, 2025
107 of 108 checks passed
@paulomach paulomach deleted the feature/dpe-5656-optional_logs branch February 6, 2025 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log level and log retention ought to be operator-configurable
4 participants